package com.chen.user.service;

import com.chen.user.model.db.User;
import com.chen.user.repository.service.iml.UserServiceImpl;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import java.util.Collection;
import java.util.List;

/**
 * @author ex_chenzy59
 * @since 2025/7/14
 */
@Service
public class UserService extends UserServiceImpl implements UserDetailsService {
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return null;
    }

    public static class SysUserDetails implements UserDetails{
        public final Long id;
        public final String username;
        public final String password;

        public SysUserDetails(User user) {
            this.id = user.getId();
            this.username = user.getName();
            this.password = user.getEmail();
        }

        @Override
        public Collection<? extends GrantedAuthority> getAuthorities() {
            return List.of();
        }

        @Override
        public String getPassword() {
            return "";
        }

        @Override
        public String getUsername() {
            return "";
        }
    }
}
